package com.valveinspectionsys.rushrepair;



import com.valveinspectionsys.R;
import com.valveinspectionsys.dbhelp.XmlNameHelper;

import com.valveinspectionsys.rushrepair.activity.RushRepairListView;
import com.valveinspectionsys.rushrepair.activity.RushRepairMapActivity;
import com.valveinspectionsys.rushrepair.activity.RushRepairRfidActivity;
import com.valveinspectionsys.rushrepair.activity.RushRepairUploadActivity;
import com.valveinspectionsys.rushrepair.db.RushRepairDao;
import com.valveinspectionsys.util.SharedPreferenceUtil;

import android.app.Activity;
import android.app.ProgressDialog;

import android.content.Intent;

import android.os.Bundle;

import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;


/**
 * 进入设备强修主界面
 * @author King
 *
 */
public class RushRepairMainActivity  extends Activity implements OnClickListener {
    
   public Button button1;//下载
   public Button button2;//巡检
   public Button button3;//查询
   public Button button4;//上传
   public SharedPreferenceUtil sp;
   public RushRepairDao dao;
   public ProgressDialog pd;
	public int total=0;
  
   @Override
   protected void onCreate(Bundle savedInstanceState) {
	setContentView(R.layout.device_routing_main);
	sp=new SharedPreferenceUtil(this);
	dao=new RushRepairDao(this, sp.getValue(XmlNameHelper.SqliteName));
	   initView();
	super.onCreate(savedInstanceState);
   }

   //初始化控件
   public void initView(){
	 button1=(Button)findViewById(R.id.device_routing_check);
	 button2=(Button)findViewById(R.id.device_routing_query);
	 button3=(Button)findViewById(R.id.device_routing_upload);
	 button4=(Button)findViewById(R.id.device_routing_down);
	 button1.setOnClickListener(this);
	 button2.setOnClickListener(this);
	 button3.setOnClickListener(this);
	 button4.setOnClickListener(this);
	 TextView textview1= (TextView)findViewById(R.id.waterlist_main_textView1);
		textview1.setText("读 卡 抢 修");
		TextView textview2= (TextView)findViewById(R.id.waterlist_main_textView2);
		textview2.setText("地 图 抢 修");
		TextView textview3= (TextView)findViewById(R.id.waterlist_main_textView3);
		textview3.setText("查         询");
		TextView textview4= (TextView)findViewById(R.id.waterlist_main_textView4);
		textview4.setText("上         传");
   }
   
   
   @Override
   public void onClick(View v) {
	Intent intent=null;
	 switch (v.getId()) {
	case R.id.device_routing_check:
	    intent=new Intent(RushRepairMainActivity.this, RushRepairUploadActivity.class);
	          startActivityForResult(intent, 1);
	  
	    
	    break;
	case R.id.device_routing_query:
	       
	    intent=new Intent(RushRepairMainActivity.this, RushRepairRfidActivity.class);
	       startActivityForResult(intent, 1);
	    break;
	case R.id.device_routing_upload:
	    intent= new Intent(RushRepairMainActivity.this, RushRepairMapActivity.class);
	        startActivityForResult(intent, 1);
	        
	    break;
	case R.id.device_routing_down:
	    intent=new Intent(RushRepairMainActivity.this, RushRepairListView.class);
	         startActivityForResult(intent, 1);
	    break;
	default:
	    break;
	}
	
   }

 
   @Override
   protected void onDestroy() {
	dao.close();
	super.onDestroy();
   }

}
